import os
from pathlib import Path
import os

BASE_DIR = Path(__file__).resolve().parent.parent


class Config:
    SECRET_KEY = os.environ.get('SECRET_KEY', 'change-me')
    default_sqlite_path = BASE_DIR / 'instance' / 'jade.db'
    os.makedirs(default_sqlite_path.parent, exist_ok=True)

    SQLALCHEMY_DATABASE_URI = os.environ.get(
        'DATABASE_URL',
        f'sqlite:///{default_sqlite_path}'
    )
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    UPLOAD_DIR = os.environ.get('UPLOAD_DIR', str(BASE_DIR / 'app' / 'static' / 'uploads'))
    MAX_CONTENT_LENGTH = 10 * 1024 * 1024


class ProdConfig(Config):
    pass


class DevConfig(Config):
    pass